Skip to content

Added fixes for hybrid level coordinates of CESM2 models#882

Merged
axel-lauer merged 1 commit into
masterfrom
fix_hybrid_lev_coords
Mar 11, 2021
Merged

Added fixes for hybrid level coordinates of CESM2 models#882
axel-lauer merged 1 commit into
masterfrom
fix_hybrid_lev_coords

Conversation

@schlunma

@schlunma schlunma commented Nov 25, 2020

Copy link
Copy Markdown
Contributor

This PR adds fixes for cl, cli and clw for the CESM2 models.

Tasks

  • Create an issue to discuss what you are going to do, if you haven't done so already (and add the link at the bottom)
  • This pull request has a descriptive title that can be used in a changelog
  • Add unit tests
  • Public functions should have a numpy-style docstring so they appear properly in the API documentation. For all other functions a one line docstring is sufficient.
  • If writing a new/modified preprocessor function, please update the documentation
  • Circle/CI tests pass. Status can be seen below your pull request. If the tests are failing, click the link to find out why.
  • Codacy code quality checks pass. Status can be seen below your pull request. If there is an error, click the link to find out why. If you suspect Codacy may be wrong, please ask by commenting.
  • Please use yamllint to check that your YAML files do not contain mistakes
  • If you make backward incompatible changes to the recipe format, make a new pull request in the ESMValTool repository and add the link below

If you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.


Closes ESMValGroup/ESMValTool#1903.

@schlunma schlunma added the cmor Related to the CMOR standard label Nov 25, 2020
@schlunma schlunma requested a review from jvegreg as a code owner November 25, 2020 15:49
@schlunma schlunma self-assigned this Nov 25, 2020
@zklaus

This comment has been minimized.

@schlunma

This comment has been minimized.

@schlunma

This comment has been minimized.

@valeriupredoi

This comment has been minimized.

@schlunma

This comment has been minimized.

@valeriupredoi

This comment has been minimized.

@schlunma

This comment has been minimized.

@schlunma schlunma requested a review from axel-lauer November 30, 2020 15:28

@axel-lauer axel-lauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me. This is a good approach to be able to work with the affected model datasets as we are not able to provide "fixes" for this issue for the affected models. Without this fix, some variables from these models could not be processed.

@zklaus zklaus left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still in the process of evaluation. My findings so far: The data from the CESM models are all broken. The lev coordinate has an invalid standard name that does not refer to a parametric coordinate, the lev bounds use a different coordinate system from the lev coordinate itself.

As such, those models need to be fixed independently from any action suggested in this PR.

That leaves us with only the CAS model. I have not finished looking into that.

As such, at the moment it is unclear if this PR will address an actual problem.

@axel-lauer

This comment has been minimized.

@schlunma

This comment has been minimized.

@zklaus

This comment has been minimized.

@ruthlorenz

Copy link
Copy Markdown

If this is an issue with the data which could (potentially) be solved by the modelling group it should be reported to them. We have done this in the past and the modelling groups are generally happy to be informed and try to fix things if they can. They then also add the information here https://errata.es-doc.org/static/index.html so other people have a chance of knowing these issues.

@schlunma

Copy link
Copy Markdown
Contributor Author

I think I found a solution to this problem:

As stated in Appendix D of the CF conventions, "the hybrid sigma-pressure coordinate for level k is defined as a(k)+b(k) or ap(k)/p0+b(k), as appropriate".

I checked this, and it is true for most CMIP6 models (the ones differing are the CESM2 models, the CAS model and 1 other model where there are numerical inconsistencies). This should allow us to calculate the correct values for the atmosphere_hybrid_sigma_pressure_coordinate for CESM2 and CAS in a fix, which will solve this problem. I will open a PR on Monday.

However, I really think that in some very specific cases it might not be useful or user-friendly to check all nitty gritty aspects of the CMOR table when there is a scientific justification. In this specific case, the height information was always given (by the formula which does NOT depend on atmosphere_hybrid_sigma_pressure_coordinate) and unique, so checking the values of the atmosphere_hybrid_sigma_pressure_coordinate is really not useful. It probably took me now a day now to get an idea how to "fix" a dataset that is not wrong from a scientific point of view, which is kind of annoying.

@sloosvel

sloosvel commented Mar 1, 2021

Copy link
Copy Markdown
Contributor

As stated in Appendix D of the CF conventions, "the hybrid sigma-pressure coordinate for level k is defined as a(k)+b(k) or ap(k)/p0+b(k), as appropriate".

That was pointed out in #840. Back in the day I tried summing a+b and I got coordinate values that match those of other models, so if that works for you, we can add this type of fix instead of skipping them. Copying the values from a model with the right coordinate as a fix would not be that bad either.

@schlunma schlunma closed this Mar 1, 2021
@schlunma schlunma force-pushed the fix_hybrid_lev_coords branch from f0a061d to 2966f54 Compare March 1, 2021 15:00
@schlunma

schlunma commented Mar 1, 2021

Copy link
Copy Markdown
Contributor Author

Will re-open soon, this was automatically closed by force-pushing the current master to it (so I can have a fresh start on this branch).

@schlunma schlunma reopened this Mar 1, 2021
@schlunma schlunma removed the request for review from jvegreg March 1, 2021 16:29
@schlunma schlunma requested review from axel-lauer, sloosvel and zklaus and removed request for sloosvel and zklaus March 1, 2021 16:29
@schlunma schlunma added fix for dataset Related to dataset-specific fix files and removed cmor Related to the CMOR standard labels Mar 1, 2021
@schlunma

schlunma commented Mar 1, 2021

Copy link
Copy Markdown
Contributor Author

I added the fix for the CESM2 models according to the link that @sloosvel (I didn't see that back then, sorry). Unfortunately the CAS model is not available on mistral anymore, so I cannot test this.

@sloosvel can you do a technical review, please?

@axel-lauer can you do a scientific review, please? I used this recipe for testing:

recipe_test_cl_cli_clw.yml.txt

@schlunma schlunma changed the title Removed coordinate data checks for hybrid level coordinates Added fixes for hybrid level coordinates of CESM2 models Mar 1, 2021

@sloosvel sloosvel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could only run the CESM2 dataset, as the others are missing on jasmin, but the fix looks good to me.

@axel-lauer axel-lauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried this fix and it produces results that look good when using no preprocessor. When using e.g. the following preprocessor to convert the data to altitude levels (same happens for pressure levels), only the lowermost level contains valid values while all other levels contain only missing values:

    extract_levels:
      levels: {cmor_table: CMIP6, coordinate: alt40}
      coordinate: altitude
      scheme: linear

This behavior differs from the results obtained using the current master branch (with --check_level=ignore to get the tool to process cl, cli or clw from CESM2). With the master branch, all altitude / pressure levels contain valid values.

I currently do not understand why this happens, but I think this might need some more investigation before this fix can be merged.

@schlunma

schlunma commented Mar 4, 2021

Copy link
Copy Markdown
Contributor Author

That is really strange....having a look at this right now!

@axel-lauer axel-lauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After talking to @schlunma I redid the tests with a clean version of this branch (fix_hybrid_lev_coords). This solved the problem, the results now look good and as expected. It seems the problem I reported yesterday was caused by a somewhat screwed up version of my local repository copy. Sorry about that. This fix can be merged now!

@schlunma

schlunma commented Mar 4, 2021

Copy link
Copy Markdown
Contributor Author

@zklaus can you either approve the changes or dismiss you review? Merging is blocked because you requested changes on the original version of this PR which is completely outdated now.

@axel-lauer

Copy link
Copy Markdown
Contributor

We have positive reviews and we need this PR now for further work. Since the PR changed in a way that the changes requested by @zklaus for an earlier version do not apply any more, I think merging this now is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix for dataset Related to dataset-specific fix files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recipes that include variables with generic level coordinates (e.g. cl) might not work anymore

7 participants